import * as types from './mutation-types'

// initial state
// shape: [{ id, quantity }]
const state = {
    count: 0
}

// getters
const getters = {
 //   checkoutStatus: state => state.checkoutStatus
    counterCount: state => state.count
}

// actions
const actions = {
    incrementAsync ({ commit, state }, playod) {
        setTimeout(() => {
            commit(types.INC_TO_COUNTER)
        }, 1000)
    }
}

// mutations
const mutations = {
    [types.INC_TO_COUNTER] (state) {
       state.count++;
    },

    [types.DEC_TO_COUNTER] (state) {
        state.count--;
    }
}

export default {
    state,
    getters,
    actions,
    mutations
}